<?
  $id        = 0;
  $start_date    = null;
  $end_date    = null;
  $published    = true;

  $teams      = array();
    if(isset($this->teams))
    $teams = $this->teams;
  
  if(isset($this->bye)){
    $id         = $this->bye->id;
    $start_date = $this->bye->start_date;
    $end_date   = $this->bye->end_date;
    $published  = $this->bye->published;
  }
  
  $bye_team_ids  = null;
  if(isset($this->bye_teams)){
  
    $bye_team_ids = array();
    foreach($this->bye_teams as $bye_team)
      array_push($bye_team_ids, $bye_team->team_id);
      
  }
  
?>
<form action="index.php" method="post" name="adminForm" id="adminForm">
<script type="text/javascript">
  jQuery(document).ready(
    function(){
      jQuery("#adminForm").validate({
        rules:  {
          start_date: {
            required: true,
            date: true
          },
          end_date: {
            required: true,
            date: true
          }
        }
      });
    }
  );
</script>
  <fieldset class="adminform">
    <legend>Details</legend>
    <table class="admintable" width="100%">
      <tr>
        <td class="key">Start Date</td>
        <td>
          <?= JHTML::calendar($start_date, "start_date", "start_date", '%Y-%m-%d' , array('size'=>'40')) ?>
        </td>
      </tr>
      <tr>
        <td class="key">End Date</td>
        <td>
          <?= JHTML::calendar($end_date, "end_date", "end_date", '%Y-%m-%d' , array('size'=>'40')) ?>
        </td>
      </tr>
      <tr>
        <td class="key">Teams</td>
        <td>
          <?= JHTML::_('select.genericlist', $teams, 'teams[]', 'multiple=multiple size=20 style="width:200px"', 'id', 'name', $bye_team_ids); ?>
        </td>
      </tr>
      <tr>
        <td class="key">Published</td>
        <td>
          <?= JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $published); ?>
        </td>
      </tr>
     </table>
   </fieldset>
       <input type="hidden" name="option" value="<?= JRequest::getVar( 'option' );?>"/>
     <input type="hidden" name="c" value="<?= JRequest::getVar('c', 'bye'); ?>" />
       <input type="hidden" name="id" value="<?= $id; ?>"/>      
     <input type="hidden" name="task" value=""/>
</form>
